# Contributor: Will Jordan <will.jordan@gmail.com>
# Maintainer: Will Jordan <will.jordan@gmail.com>
pkgname=vips
pkgver=8.12.2
pkgrel=5
pkgdesc="fast image processing library with low memory needs"
url="https://libvips.github.io/libvips/"
# ppc64le blocked by failing test: test_seq.sh
arch="all !ppc64le"
license="LGPL-2.1-or-later"
makedepends="
	cfitsio-dev
	cgif-dev
	expat-dev
	fftw-dev
	giflib-dev
	glib-dev
	gobject-introspection-dev
	imagemagick-dev
	lcms2-dev
	libexif-dev
	libheif-dev
	libimagequant-dev
	libjpeg-turbo-dev
	libjxl-dev
	libpng-dev
	libwebp-dev
	openexr-dev
	openjpeg-dev
	orc-dev
	pango-dev
	poppler-dev
	libspng-dev
	tiff-dev
	"
checkdepends="bc"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-poppler $pkgname-magick $pkgname-tools"
source="https://github.com/libvips/libvips/releases/download/v$pkgver/vips-$pkgver.tar.gz"

case "$CARCH" in
	s390x|riscv64) ;;
	*) makedepends="$makedepends librsvg-dev" ;;
esac

# secfixes:
#   8.9.0-r0:
#     - CVE-2020-20739
#   8.8.2-r0:
#     - CVE-2019-17534

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-debug=no \
		--without-gsf \
		--disable-static \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--docdir=/usr/share/doc \
		--enable-introspection
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

tools() {
	pkgdesc="Command-line tools for $pkgname"

	amove usr/bin
}

poppler() {
	pkgdesc="Poppler support for $pkgname"

	amove usr/lib/vips-modules-${pkgver%.*}/vips-poppler.so
}

magick() {
	pkgdesc="Imagemagick support for $pkgname"

	amove usr/lib/vips-modules-${pkgver%.*}/vips-magick.so
}

sha512sums="
9df337b01234199c00e5007db9d4711dac81377a521a3fd65246778be6907f54c2fd7c1f23bde1c37644d08e5e5034d65f6095adc072e29fc9185a607a97fe61  vips-8.12.2.tar.gz
"
